package thread.sisuo;

public class Client2 {

    public static void main(String[] args){
        final Account accountFrom = new Account();
        final Account accountTo = new Account();
        final Account transferMoneyA =  new Account();
        transferMoneyA.setMoney(20);


        final Account transferMoneyB =  new Account();
        transferMoneyB.setMoney(30);

       final YouXuSuo youXuSuo = new YouXuSuo();
        Runnable runnableA   = new Runnable() {
            @Override
            public void run() {

                    youXuSuo.transferMoney(accountFrom,accountTo,transferMoneyA);

            }
        };
        Runnable runnableB  = new Runnable() {
            @Override
            public void run() {

                    youXuSuo.transferMoney(accountTo,accountFrom,transferMoneyB);

            }
        };

        Thread  threadA = new Thread(runnableA);
        Thread threadB = new Thread(runnableB);
        threadA.start();
        threadB.start();

    }
}
